package com.xayy.mgt.model;

import cn.kawins.mybatis.base.BaseModel;
import cn.kawins.mybatis.interceptor.FillingCreateTime;
import cn.kawins.mybatis.interceptor.InsertAutoFilling;
import cn.kawins.mybatis.interceptor.UpdateAutoFilling;
import cn.kawins.mybatis.util.SnowflakeId;
import cn.kawins.spring.mvc.validator.Group;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 关联参数表(AssociationParameter)实体类
 *
 * @author zhangxa
 * @since 2023-08-15 16:40:36
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "health_xw.t_association_parameter")
@EqualsAndHashCode(callSuper = true)
public class AssociationParameter extends BaseModel<Long> {

    @Id
    @ApiModelProperty(value = "主键")
    @KeySql(genId = SnowflakeId.class)
    @JsonSerialize(using = ToStringSerializer.class)
    @Column(name = "id")
    private Long id;

    /**
     * 该条关联参数所属节点id
     */
    @ApiModelProperty(value = "该条关联参数所属节点id", required = true)
    @Column(name = "node_id")
    @NotNull(groups = Group.Insert.class,message = "关联参数所属节点id不能为空")
    private Long nodeId;

    /**
     * （唯一）关联参数名称（指标名称）
     */
    @ApiModelProperty(value = "（唯一）关联参数名称（指标名称）", required = true)
    @Column(name = "metrics_name")
    @NotBlank(groups = Group.Insert.class,message = "关联参数名称（指标名称）不能为空")
    private String metricsName;
    /**
     * （唯一）关联参数代号（指标代号）
     */
    @ApiModelProperty(value = "（唯一）关联参数代号（指标代号）", required = true)
    @Column(name = "metrics_code")
    @NotBlank(groups = Group.Insert.class,message = "关联参数代号（指标代号）不能为空")
    private String metricsCode;

    /**
     * 处理时长
     */
    @ApiModelProperty(value = "处理时长", required = true)
    @Column(name = "processing_time")
    private Integer processingTime;
    /**
     * 说明
     */
    @ApiModelProperty(value = "说明")
    @Column(name = "notes")
    private String notes;

    /**
     * 关联参数类型，1：遥测参数2：功能指标3：性能指标
     */
    @ApiModelProperty(value = "关联参数类型，1：遥测参数2：功能指标3：性能指标4：健康度", required = true)
    @Column(name = "type")
    @NotNull(groups = Group.Insert.class,message = "关联参数类型不能为空")
    private Integer type;

    /**
     * 指标所属节点id
     */
    @ApiModelProperty(value = "指标所属节点id", required = true)
    @Column(name = "param_node_id")
    private Long paramNodeId;

    /**
     * 节点参数（遥测参数名称、功能指标名称、性能指标名称
     */
    @ApiModelProperty(value = "节点参数（遥测参数名称、功能指标名称、性能指标名称", required = true)
    @Column(name = "param_name")
    private String paramName;

    /**
     * 节点代号（遥测参数代号、功能指标代号、性能指标代号）
     */
    @ApiModelProperty(value = "节点代号（遥测参数代号、功能指标代号、性能指标代号）", required = true)
    @Column(name = "param_code")
    private String paramCode;
    /**
     * 自定义参数
     */
    @ApiModelProperty(value = "自定义参数", required = true)
    @Column(name = "custom_param")
    @NotBlank(groups = Group.Insert.class,message = "自定义参数不能为空")
    private String customParam;

    /**
     * 创建时间
     */
    @Column(name = "created_time")
    @InsertAutoFilling(value = FillingCreateTime.class)
    @ApiModelProperty(value = "创建时间", accessMode = ApiModelProperty.AccessMode.READ_ONLY,
        example = "2010-01-01 00:00:00")
    private Date createdTime;
    /**
     * 更新时间
     */
    @Column(name = "updated_time")
    @UpdateAutoFilling(value = FillingCreateTime.class)
    @ApiModelProperty(value = "最后更新时间", accessMode = ApiModelProperty.AccessMode.READ_ONLY,
        example = "2010-01-01 00:00:00")
    private Date updatedTime;

}
